type Func = (...args: any[]) => any;
export function throttle<T>(fn: Func, delay: number): Func {
    let lastTime = 0
    return function (this: T, ...args: any[]) {
        const now = Date.now()
        if (now - lastTime > delay) {
            fn.apply(this, args)
            lastTime = now
        }
    }
}